package com.drunkoid.server;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet  extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8240424265931138986L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		try {
			response.setContentType("text/html");
			response.getWriter().print("hello");
			OutputStream outstr = response.getOutputStream();
			ObjectOutputStream oos = new  ObjectOutputStream(outstr);
			oos.writeObject(1);
			oos.flush();
			oos.close();

		} catch (Exception e) { 
			e.printStackTrace();
		}		
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}